<%@page import="java.io.FileNotFoundException"%><%@page import="helper.Export"%><%


if (request.getParameter("id") != null) {
	try{
		java.io.File file = new java.io.File(request.getParameter("id")+"_"+request.getParameter("ebenenVer")+".pdf");
		if(!file.exists()){
			Export.generiereVersionierteVersion(Integer.parseInt(request.getParameter("id")), Long.parseLong(request.getParameter("ebenenVer")));
		}
		java.io.FileInputStream fileInputStream = new java.io.FileInputStream(file);
		byte[] data = new byte[(int) file.length()];
		fileInputStream.read(data);
		fileInputStream.close();   	
		response.setContentType("application/pdf");
		java.io.OutputStream output = response.getOutputStream();
		output.write(data);
		output.close();
	}catch (FileNotFoundException e){
		 System.out.println("File not found.");
	}
} 
%>